home *** CD-ROM | disk | FTP | other *** search
/ Chip 1997 December / CHIPNET Aralık 1997.iso / linux / redhat / misc / src / install / mount_~2.c < prev    next >
Encoding:
C/C++ Source or Header  |  1997-08-11  |  3.1 KB  |  125 lines

  1. /*
  2.  * Please do not edit this file.
  3.  * It was generated using rpcgen.
  4.  */
  5.  
  6. #include "mount.h"
  7. #include <stdio.h>
  8. #include <stdlib.h>/* getenv, exit */
  9. #include <rpc/pmap_clnt.h> /* for pmap_unset */
  10. #include <string.h> /* strcmp */ 
  11. #include <memory.h>
  12. #include <sys/socket.h>
  13. #include <netinet/in.h>
  14.  
  15. #ifdef __STDC__
  16. #define SIG_PF void(*)(int)
  17. #endif
  18.  
  19. static void
  20. mountprog_1(struct svc_req *rqstp, register SVCXPRT *transp)
  21. {
  22.     union {
  23.         dirpath mountproc_mnt_1_arg;
  24.         dirpath mountproc_umnt_1_arg;
  25.     } argument;
  26.     char *result;
  27.     xdrproc_t xdr_argument, xdr_result;
  28.     char *(*local)(char *, struct svc_req *);
  29.  
  30.     switch (rqstp->rq_proc) {
  31.     case MOUNTPROC_NULL:
  32.         xdr_argument = (xdrproc_t) xdr_void;
  33.         xdr_result = (xdrproc_t) xdr_void;
  34.         local = (char *(*)(char *, struct svc_req *)) mountproc_null_1_svc;
  35.         break;
  36.  
  37.     case MOUNTPROC_MNT:
  38.         xdr_argument = (xdrproc_t) xdr_dirpath;
  39.         xdr_result = (xdrproc_t) xdr_fhstatus;
  40.         local = (char *(*)(char *, struct svc_req *)) mountproc_mnt_1_svc;
  41.         break;
  42.  
  43.     case MOUNTPROC_DUMP:
  44.         xdr_argument = (xdrproc_t) xdr_void;
  45.         xdr_result = (xdrproc_t) xdr_mountlist;
  46.         local = (char *(*)(char *, struct svc_req *)) mountproc_dump_1_svc;
  47.         break;
  48.  
  49.     case MOUNTPROC_UMNT:
  50.         xdr_argument = (xdrproc_t) xdr_dirpath;
  51.         xdr_result = (xdrproc_t) xdr_void;
  52.         local = (char *(*)(char *, struct svc_req *)) mountproc_umnt_1_svc;
  53.         break;
  54.  
  55.     case MOUNTPROC_UMNTALL:
  56.         xdr_argument = (xdrproc_t) xdr_void;
  57.         xdr_result = (xdrproc_t) xdr_void;
  58.         local = (char *(*)(char *, struct svc_req *)) mountproc_umntall_1_svc;
  59.         break;
  60.  
  61.     case MOUNTPROC_EXPORT:
  62.         xdr_argument = (xdrproc_t) xdr_void;
  63.         xdr_result = (xdrproc_t) xdr_exports;
  64.         local = (char *(*)(char *, struct svc_req *)) mountproc_export_1_svc;
  65.         break;
  66.  
  67.     case MOUNTPROC_EXPORTALL:
  68.         xdr_argument = (xdrproc_t) xdr_void;
  69.         xdr_result = (xdrproc_t) xdr_exports;
  70.         local = (char *(*)(char *, struct svc_req *)) mountproc_exportall_1_svc;
  71.         break;
  72.  
  73.     default:
  74.         svcerr_noproc(transp);
  75.         return;
  76.     }
  77.     (void) memset((char *)&argument, 0, sizeof (argument));
  78.     if (!svc_getargs(transp, xdr_argument, (caddr_t) &argument)) {
  79.         svcerr_decode(transp);
  80.         return;
  81.     }
  82.     result = (*local)((char *)&argument, rqstp);
  83.     if (result != NULL && !svc_sendreply(transp, xdr_result, result)) {
  84.         svcerr_systemerr(transp);
  85.     }
  86.     if (!svc_freeargs(transp, xdr_argument, (caddr_t) &argument)) {
  87.         fprintf(stderr, "unable to free arguments");
  88.         exit(1);
  89.     }
  90.     return;
  91. }
  92.  
  93. int
  94. main(int argc, char **argv)
  95. {
  96.     register SVCXPRT *transp;
  97.  
  98.     (void) pmap_unset(MOUNTPROG, MOUNTVERS);
  99.  
  100.     transp = svcudp_create(RPC_ANYSOCK);
  101.     if (transp == NULL) {
  102.         fprintf(stderr, "cannot create udp service.");
  103.         exit(1);
  104.     }
  105.     if (!svc_register(transp, MOUNTPROG, MOUNTVERS, mountprog_1, IPPROTO_UDP)) {
  106.         fprintf(stderr, "unable to register (MOUNTPROG, MOUNTVERS, udp).");
  107.         exit(1);
  108.     }
  109.  
  110.     transp = svctcp_create(RPC_ANYSOCK, 0, 0);
  111.     if (transp == NULL) {
  112.         fprintf(stderr, "cannot create tcp service.");
  113.         exit(1);
  114.     }
  115.     if (!svc_register(transp, MOUNTPROG, MOUNTVERS, mountprog_1, IPPROTO_TCP)) {
  116.         fprintf(stderr, "unable to register (MOUNTPROG, MOUNTVERS, tcp).");
  117.         exit(1);
  118.     }
  119.  
  120.     svc_run();
  121.     fprintf(stderr, "svc_run returned");
  122.     exit(1);
  123.     /* NOTREACHED */
  124. }
  125.